{{- define "main" -}}
  {{- /* In some edge cases, .CurrentSection is not available. If it's not
    available the build would break since we need .CurrentSection.File.Dir later on. */ -}}
  {{- if .CurrentSection -}}
    {{- $list_page := .Site.GetPage "page" (printf "%s%s" .CurrentSection.File.Dir "_index") -}}
    {{/* real_page is the _index.md file which indicates the page that is
      calling this list.html layout. We need this file to find the path of the
      page more easily. page indicates the _index headless page in this layout
      where we can find the fragments for the homepage or section pages. */}}
    {{- $.Scratch.Set "layout_info" (dict "root" $ "real_page" . "page" $list_page "page_scratch" $.Scratch) -}}
    {{- partial "helpers/fragments.html" (dict "page_scratch" $.Scratch) -}}
  {{- end -}}
{{- end -}}
